<pre>-- MODE = "UTILISATEUR"on openBackground  hide menubar  hide tool window  hide msg box  set cantAbort of this stack to false  startLauzonPeripheral  pass openBackgroundend openBackgroundon closeBackground  stopLauzonPeripheral  show menubar  pass closeBackgroundend closeBackgroundon openCard  closeSPort dontCloseDriver -- ie.flush serial port for new question.  repeat    put userAnswer() into choix    if choix is not empty then      send mouseUp to btn choix  -- ie.hilite selected choix-multiple.      if choix is "Valider" and reponse() is not empty then        put quote & the short name of this cd && reponse() & quote into note        pushCard        set lockMessages to false        go to cd note of stack pile("notesFormatives") in a new window        exit repeat      end if    end if  end repeatend openCardfunction reponse  if hilite of btn "A=" is true then return "A"  if hilite of btn "B=" is true then return "B"  if hilite of btn "C=" is true then return "C"  if hilite of btn "D=" is true then return "D"  return emptyend reponsefunction userAnswer  --------------------------------------------------------------------------  put charsAvailable() into theNumberOfChars  if theNumberOfChars < 1 then return empty  --------------------------------------------------------------------------  repeat until charsAvailable() < 1    put recvBytes(1) into userAnswerNumber    if userAnswerNumber is 0 or userAnswerNumber is not in "1,2,4,8,16"    then next repeat    else      closeSPort dontCloseDriver -- ie.flush serial port after an answer.      if userAnswerNumber is 1 then return "A="      if userAnswerNumber is 2 then return "B="      if userAnswerNumber is 4 then return "C="      if userAnswerNumber is 8 then return "D="      if userAnswerNumber is 16 then return "Valider"    end if  end repeat  --------------------------------------------------------------------------  return emptyend userAnsweron mouseUp  -- temporary, while peripheral is not ready.  if the target contains "card field" then    put (word 3 of the short target & "=") into btnName    if there is a btn btnName then click at the loc of btn btnName    exit mouseUp  end if  pass mouseUpend mouseUp</pre>